package com.sskj.mine.presenter;

import com.lzy.okgo.model.Response;
import com.sskj.common.base.HttpData;
import com.sskj.lib.http.JsonCallBack;
import com.sskj.mine.ui.activity.SecurityCenterActivity;


public class SecurityCenterActivityPresenter extends BasePresenter<SecurityCenterActivity> {

    public void toggleSms(boolean isOpen, String code) {
        httpService.toggleSms(isOpen ? "start" : "stop", code)
                .execute(new JsonCallBack<HttpData>(this) {
                    @Override
                    public void onSuccess(Response<HttpData> response) {
                        mView.toggleSmsSuccess();
                    }
                });
    }

    public void toggleGoogle(boolean isOpen, String code) {
        httpService.toggleGoogle(isOpen ? "start" : "stop", code)
                .execute(new JsonCallBack<HttpData>(this) {
                    @Override
                    public void onSuccess(Response<HttpData> response) {
                        mView.toggleGoogleSuccess();
                    }
                });
    }
}
